﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeJC.DAL.Model;

namespace DeJC.DAL.Repository {
    public class UserRepository:RepositoryBase<User>
    {
        public UserRepository(TheListEntities context) : base(context)
        {
        }

        public User GetUser(string userName, string password)
        {
            return _dataContext.Users.FirstOrDefault(x => x.UserName == userName && x.Password == password);
        }

        public User GetUser(string userName)
        {
            return _dataContext.Users.FirstOrDefault(x => x.UserName == userName);
        }

        public User GetUser(object guid) {
            string activationCode=guid.ToString();
            return _dataContext.Users.FirstOrDefault(u => u.ActivationCode==activationCode);
        }
    }
}
